package cn.tedu.micro.demo.device.controller;

import cn.tedu.micro.demo.common.pojo.protocol.JsonResult;
import cn.tedu.micro.demo.common.pojo.vo.GunInfoVO;
import cn.tedu.micro.demo.device.service.DeviceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * demo业务场景 处理和设备有关功能 所有接口
 */
@RestController
@Slf4j
public class DeviceController {
    @Autowired
    private DeviceService deviceService;
    /**
     * 请求方式 get
     * 请求地址 /device/gun/info/{gunId}
     * 返回值JsonResult<GunInfoVO>
     */
    @GetMapping("/device/gun/info/{gunId}")
    public JsonResult<GunInfoVO> getGunStatus(@PathVariable Integer gunId){
        //调用业务;
        GunInfoVO gunInfoVO = deviceService.gunDetail(gunId);
        return JsonResult.ok("ok",gunInfoVO);
    }
}
